import {use} from 'h3'

export default defineNuxtRouteMiddleware((to, from) => {
  // const nuxtApp = useNuxtApp()
  // const state = useState('route-state', () => ({
  //   needAuthInClient: false,
  //   loginRedirect: '',
  // }))
  // nuxtApp.payload.routeState = state
  //
  // if (import.meta.server) {
  //   console.log('[route-middleware]', from.path, to.path, state.value.needAuthInClient)
  // }
  // if (import.meta.client) {
  //   console.log('[route-middleware]', from.path, to.path, state.value.needAuthInClient)
  // }
  //
  // if (to.path !== '/') {
  //   state.value.needAuthInClient = true
  // }
  //
  // if (state.value.needAuthInClient) {
  //   return navigateTo('/')
  // }
})
